home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / lib-6.9.tar.gz / lib-6.9.tar / texmf / tex / tugboat / tugboat.sty (.txt) < prev    next >
Texinfo Document  |  1993-08-29  |  69KB  |  1,748 lines

  1. %% @texfile{
  2. %%     filename="tugboat.sty",
  3. %%     version="1.14",
  4. %%     date="19-Feb-1993",
  5. %%     filetype="Plain TeX macros for TUGboat",
  6. %%     copyright="Copyright (C) TeX Users Group.
  7. %%            Copying of this file is authorized only if either:
  8. %%            (1) you make absolutely no changes to your copy, OR
  9. %%            (2) if you do make changes, you first rename it to some
  10. %%                other name.",
  11. %%     author="TeX Users Group",
  12. %%     address="TeX Users Group",
  13. %%            P. O. Box 869,
  14. %%            Santa Barbara, CA 93102,
  15. %%            USA",
  16. %%     telephone="805-963-1338",
  17. %%     email="Internet: TUGboat@Math.AMS.org",
  18. %%     codetable="ISO/ASCII",
  19. %%     checksumtype="line count",
  20. %%     checksum="2223",
  21. %%     keywords="tex users group, tugboat, plain tex",
  22. %%     abstract="This file contains the plain-based macros
  23. %%            for preparation of TUGboat, the Communications
  24. %%            of the TeX Users Group."
  25. %%     }
  26. %% *********************************************************
  27. %%  TeXing with this file also requires the following files:
  28. %%      TUGBOAT.CMN (version 1.08+)
  29. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  30. % TUGBOAT.STY
  31. \def\thistubstyle{plain}
  32. \def\fileversion{v1.14}
  33. \def\filedate{19 February 1993}
  34. % general items
  35. \def\makeatletter{\catcode`\@=11 }
  36. \makeatletter           % used, as in PLAIN, in protected control sequences
  37. %  stop reading this file if it's been loaded already
  38. \ifx\tugstyloaded@\thistubstyle\makeatother\initializearticle
  39.  \endinput\else\let\tugstyloaded@\thistubstyle\fi
  40. \message{File `TUGBOAT.STY' \fileversion \space\space <\filedate>}
  41. \input tugboat.cmn      % macros common to tugboat.sty and
  42.                         % ltugboat.sty (latex style file)
  43. %  some things with the same names as in, or reiterated from, AMS-TeX
  44. \def\document{}                % override an AMS-TeX convention
  45. \output{\output@}
  46. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  47. %  Directory.
  48. %  **  fonts
  49. %  **  page dimensions
  50. %  **  headers/footers
  51. %  **  page adjustment
  52. %  **  output
  53. %  **  general mechanism for tags
  54. %  **  titles, authors, addresses
  55. %  **  heads
  56. %  **  text and subtext
  57. %  **  lists
  58. %  **  verbatim
  59. %  **  figures
  60. %  **  utilities
  61. %  **  initialization
  62. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  63. %                                                                            
  64. %     *****  fonts  *****
  65. %                                                                            
  66. %  Struts give ascenders and descenders to assist in baseline alignment
  67. %  (e.g. of adjoining vertical boxes); useful only with text fonts.
  68. %  \strut is defined in PLAIN .  The structure of \strutt is equivalent.
  69. \newbox\struttbox
  70. \def\strutt{\relax\ifmmode\copy\struttbox\else\unhcopy\struttbox\fi}
  71. %  Struts are given the following dimensions for use in TUGboat:
  72. %  \strut = height/depth of parenthesis in current font
  73. %           (not the same as PLAIN)
  74. %  \strutt height + depth = \normalbaselineskip,
  75. %           height = same as \strut
  76. %           (equivalent to PLAIN \strut )
  77. %  The fonts below are sufficient for most ordinary TUGboat production.
  78. %  Additional titling fonts are defined elsewhere, and occasionally an
  79. %  extra font will be needed for a particular item (e.g. the device
  80. %  charts) and defined in that file.
  81. %  All PLAIN CM fonts.
  82. \font\tenrm=cmr10
  83. \font\ninerm=cmr9
  84. \font\eightrm=cmr8
  85. \font\sevenrm=cmr7
  86. \font\sixrm=cmr6
  87. \font\fiverm=cmr5
  88. \font\teni=cmmi10 \skewchar\teni='177
  89. \font\ninei=cmmi9 \skewchar\ninei='177
  90. \font\eighti=cmmi8 \skewchar\eighti='177
  91. \font\seveni=cmmi7 \skewchar\seveni='177
  92. \font\sixi=cmmi6 \skewchar\sixi='177
  93. \font\fivei=cmmi5 \skewchar\fivei='177
  94. \font\tensy=cmsy10 \skewchar\tensy='60
  95. \font\ninesy=cmsy9 \skewchar\ninesy='60
  96. \font\eightsy=cmsy8 \skewchar\eightsy='60
  97. \font\sevensy=cmsy7 \skewchar\sevensy='60
  98. \font\sixsy=cmsy6 \skewchar\sixsy='60
  99. \font\fivesy=cmsy5 \skewchar\fivesy='60
  100. \font\tenex=cmex10
  101. \font\tenbf=cmbx10
  102. \font\ninebf=cmbx9
  103. \font\eightbf=cmbx8
  104. \font\sevenbf=cmbx7
  105. \font\sixbf=cmbx6
  106. \font\fivebf=cmbx5
  107. \font\tentt=cmtt10
  108. \font\ninett=cmtt9
  109. \font\eighttt=cmtt8
  110. \font\tensl=cmsl10
  111. \font\ninesl=cmsl9
  112. \font\eightsl=cmsl8
  113. \font\sevensl=cmti7             %  Would use cmsl7 if it were standard.
  114.                                 %  Currently needed only for \def of \LaTeX
  115. \font\tenit=cmti10
  116. \font\nineit=cmti9
  117. \font\eightit=cmti8
  118. \font\sevenit=cmti7
  119. \font\tenuit=cmu10 
  120. \font\tenbfsl=cmbxsl10
  121. \font\tensmc=cmcsc10
  122. \font\ninesmc=cmcsc10           % redefine if cmcsc9 and/or cmcsc8 exist
  123. \font\eightsmc=cmcsc10
  124. \font\tentex=cmtex10            % for ASCII character set
  125. \def\mit{\fam\@ne}              % from plain
  126. \def\cal{\fam\tw@}              % from plain
  127. \def\sy{\cal}
  128. %  cmss fonts are not needed all the time.  Permit as-needed access.
  129. \def\LoadSansFonts{%
  130.   \global\font\twelvess=cmss10 scaled \magstep1
  131.   \global\font\tenss=cmss10
  132.   \global\font\niness=cmss9
  133.   \global\font\eightss=cmss8
  134.   \addto\tenpoint{\def\ssf{\tenss}}
  135.   \addto\ninepoint{\def\ssf{\niness}}
  136.   \addto\eightpoint{\def\ssf{\eightss}}
  137.   \gdef\LoadSansFonts{}}
  138. %  TUGboat section heads
  139. \font \seventeenssb=cmssbx10 scaled \magstep3
  140. \font \twelvessb=cmssbx10 scaled \magstep1
  141. \newfam\sectitlefam
  142. \textfont\sectitlefam=\seventeenssb \scriptfont\sectitlefam=\twelvessb
  143. %  \stbaselineskip set in tugboat.com
  144. \def\sectitlefont{%
  145.   \fam\sectitlefam \seventeenssb \baselineskip=\stbaselineskip }
  146. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  147. %     *****  Definitions of \tenpoint, \ninepoint, etc.  *****
  148. %  Following is a facility for adding commands to \tenpoint, \ninepoint
  149. %  and \eightpoint.  \LoadSansFonts uses this technique above.
  150. %  Also used to add math families, as with:
  151. %       \addto\tenpoint{\textfont\frakfam...}
  152. %  to add a Fraktur family.
  153. \def\addto#1#2{%
  154.   \csname @addsto\string#1\endcsname=
  155.   \expandafter{\the\csname @addsto\string#1\endcsname#2}}
  156. \def\@additionsto#1{\expandafter\the\csname @addsto\string#1\endcsname}
  157. \expandafter\newtoks\csname @addsto\string\tenpoint\endcsname
  158. \expandafter\newtoks\csname @addsto\string\ninepoint\endcsname
  159. \expandafter\newtoks\csname @addsto\string\eightpoint\endcsname
  160. \newskip\ttglue
  161. \def\setttglue{%
  162.   \edef\@thefont{\the\font}%  to restore this font after the setting
  163.   \tt \ttglue=.5em plus .25em minus .15em
  164.   \@thefont}
  165. %  We assume that \scriptscriptfonts remain the same throughout
  166. \scriptscriptfont\z@=\fiverm
  167. \scriptscriptfont\@ne=\fivei
  168. \scriptscriptfont\tw@=\fivesy
  169. \scriptscriptfont\thr@@=\tenex
  170. \scriptscriptfont\bffam=\sixbf
  171. \newdimen\normaltenpointstretch    \normaltenpointstretch=1.6667pt
  172. \def\NormalTenPointSpacing{\AdjustNormalSpacing\tenpoint{}}
  173. \def\StretchyTenPointSpacing{\AdjustNormalSpacing\tenpoint{2.4}}
  174. \def\tenpoint{%
  175.   \normalbaselineskip=12pt
  176.   \abovedisplayskip=3pt plus 3pt minus 1pt
  177.   \belowdisplayskip=3pt plus 3pt minus 1pt
  178.   \abovedisplayshortskip=0pt plus 3pt
  179.   \belowdisplayshortskip=1pt plus 3pt minus 1pt
  180.   \def\rm{\fam\z@\tenrm}%
  181.   \textfont\z@=\tenrm \scriptfont\z@=\sevenrm
  182.   \def\oldstyle{\fam\@ne\teni}%
  183.   \textfont\@ne=\teni \scriptfont\@ne=\seveni
  184.   \textfont\tw@=\tensy \scriptfont\tw@=\sevensy
  185.   \textfont\thr@@=\tenex \scriptfont\thr@@=\tenex
  186.   \def\it{\fam\itfam\tenit}%
  187.   \textfont\itfam=\tenit \scriptfont\itfam=\sevenit
  188.   \def\sl{\fam\slfam\tensl}%
  189.   \textfont\slfam=\tensl \scriptfont\slfam=\sevensl
  190.   \def\bf{\def\sl{\tenbfsl}\fam\bffam\tenbf}%
  191.   \textfont\bffam=\tenbf \scriptfont\bffam=\eightbf
  192.   \def\smc{\tensmc}%
  193.   \def\SMC{\ninerm}%
  194.   \def\tt{\tentt}%
  195.   \setttglue
  196.   \def\upright{\tenuit}%
  197.   \setbox\strutbox=\hbox{\vrule height7.5pt depth2.5pt width\z@}%
  198.   \setbox\struttbox=\hbox{\vrule height8.5pt depth3.5pt width\z@}%
  199.   \normalbaselines \rm
  200.   \@additionsto\tenpoint}
  201. \tenpoint                       % initialize -- default font
  202. \newdimen\normalninepointstretch   \normalninepointstretch=1.5pt
  203. \def\NormalNinePointSpacing{\AdjustNormalSpacing\ninepoint{}}
  204. \def\StretchyNinePointSpacing{\AdjustNormalSpacing\ninepoint{2.4}}
  205. \def\ninepoint{\normalbaselineskip=11pt
  206.   \abovedisplayskip=2.5pt plus 2.5pt minus 1pt
  207.   \belowdisplayskip=2.5pt plus 2.5pt minus 1pt
  208.   \abovedisplayshortskip=0pt plus 2.5pt
  209.   \belowdisplayshortskip=1pt plus 2.5pt minus 1pt
  210.   \def\rm{\fam\z@\ninerm}%
  211.   \textfont\z@=\ninerm \scriptfont\z@=\sevenrm
  212.   \def\oldstyle{\fam\@ne\ninei}%
  213.   \textfont\@ne=\ninei \scriptfont\@ne=\seveni
  214.   \textfont\tw@=\ninesy \scriptfont\tw@=\sevensy
  215.   \def\it{\fam\itfam\nineit}%
  216.   \textfont\itfam=\nineit
  217.   \def\sl{\fam\slfam\ninesl}%
  218.   \textfont\slfam=\ninesl
  219.   \def\bf{\fam\bffam\ninebf}%
  220.   \textfont\bffam=\ninebf \scriptfont\bffam=\sevenbf
  221.   \def\smc{\ninesmc}%
  222.   \def\SMC{\eightrm}%
  223.   \def\tt{\ninett}%
  224.         \setttglue
  225.   \setbox\strutbox=\hbox{\vrule height 6.75pt depth 2.25pt width\z@}%
  226.   \setbox\struttbox=\hbox{\vrule height 7.75pt depth 3.25pt width\z@}%
  227.   \normalbaselines \rm
  228.   \@additionsto\ninepoint }
  229. %  The following setting can be used when baselineskip = 10pt
  230. %  \setbox\struttbox=\hbox{\vrule height 7.25pt depth 2.75pt width\z@}%
  231. \newdimen\normaleightpointstretch  \normaleightpointstretch=1.333pt
  232. \def\NormalEightPointSpacing{\AdjustNormalSpacing\eightpoint{}}
  233. \def\StretchyEightPointSpacing{\AdjustNormalSpacing\eightpoint{2.25}}
  234. \def\eightpoint{\normalbaselineskip=10pt
  235.   \abovedisplayskip=2pt plus 2pt minus 1pt
  236.   \belowdisplayskip=2pt plus 2pt minus 1pt
  237.   \abovedisplayshortskip=0pt plus 2pt
  238.   \belowdisplayshortskip=1pt plus 2pt minus 1pt
  239.   \def\rm{\fam\z@\eightrm}%
  240.   \textfont\z@=\eightrm \scriptfont\z@=\sixrm
  241.   \def\oldstyle{\fam\@ne\eighti}%
  242.   \textfont\@ne=\eighti \scriptfont\@ne=\sixi
  243.   \textfont\tw@=\eightsy \scriptfont\tw@=\sixsy
  244. % \textfont\thr@@=\eightex \scriptfont\thr@@=\eightex
  245.   \def\it{\fam\itfam\eightit}%
  246.   \textfont\itfam=\eightit
  247.   \def\sl{\fam\slfam\eightsl}%
  248.   \textfont\slfam=\eightsl
  249.   \def\bf{\fam\bffam\eightbf}%
  250.   \textfont\bffam=\eightbf \scriptfont\bffam=\sixbf
  251.   \def\smc{\eightsmc}%
  252.   \def\tt{\eighttt}%
  253.   \setttglue
  254.   \setbox\strutbox=\hbox{\vrule height 6pt depth 2pt width\z@}%
  255.   \setbox\struttbox=\hbox{\vrule height 7pt depth 3pt width\z@}%
  256.   \normalbaselines \rm
  257.   \@additionsto\eightpoint }
  258. %  The 8pt cap/small cap font is not loaded.  See a corresponding remark
  259. %  above for the 9pt csc font.
  260. %  this is equivalent to baselineskip = 9pt
  261. %  \setbox\struttbox=\hbox{\vrule height 6.5pt depth 2.5pt width\z@}%
  262. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  263. %  Following will allow text to be a bit stretchier than the built-in
  264. %  setting; TeXbook, page 433, 355
  265. \def\@setstretch{\fontdimen3\the\font=}
  266. \def\AdjustNormalSpacing#1#2{%  #1=pointsize, #2=adjustment factor
  267.   {\T@stDimen=#2\csname normal\expandafter\gobble\string#1stretch\endcsname
  268.   #1%
  269.   \rm\@setstretch\T@stDimen
  270.   \it\@setstretch\T@stDimen
  271.   \bf\@setstretch\T@stDimen
  272. %  Anticipated changes to this font handling scheme:
  273. %  Dynamic loading of fonts, probably in groups according to size
  274. %  Removal of \rm, \bf, etc., from \*point expansions, replacement
  275. %    by generic \rm, \bf, etc. definitions
  276. %  Mechanism for switching neatly between serif and sans-serif
  277. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  278. %                                                                             
  279. %     *****  page dimensions  *****
  280. %                                                                             
  281. %  vertical dimensions
  282. \newdimen\trimlgt       \trimlgt=11in           % 10.5in (vols 7-9)
  283. \newdimen\headmargin    \headmargin=3.5pc       % 2.5pc  (vols 7-9)
  284. \newdimen\pagelgt
  285. \newdimen\rheadlgt      \rheadlgt=2.5pc         % + headmargin = 6pc = 1in
  286. \newdimen\toplgt        \toplgt=\z@
  287. \newdimen\normalcollgt  \normalcollgt=54pc      % 52pc for 5#2
  288. \newdimen\collgt        \collgt=\normalcollgt
  289. \newdimen\Collgt
  290. \maxdepth=2pt
  291. \newdimen\botlgt        \botlgt=\z@
  292. \newdimen\rfootlgt      \rfootlgt=2pc
  293. \newif\ifThisIsFirstPage        \ThisIsFirstPagefalse
  294. \def\resetpagelgt{%
  295.   \pagelgt=\collgt \Collgt=\collgt
  296.   \advance\pagelgt by \rheadlgt
  297.   \ifThisIsFirstPage \advance\Collgt by-\toplgt
  298.                      \advance\Collgt by-\botlgt \fi
  299.   \advance\pagelgt by \maxdepth
  300.   \global\advance\pagelgt by \rfootlgt
  301.   \global\vsize=\Collgt }
  302. \def\resetfpagelgt{%
  303.   \global\ThisIsFirstPagetrue
  304.   \resetpagelgt }                 % exclude special first page material
  305. \resetpagelgt
  306. \raggedbottom
  307. %  horizontal dimensions
  308. \newdimen\colwd
  309. \newdimen\intercolwd    \intercolwd=\z@
  310. \newdimen\pagewd        \pagewd=39pc
  311. \newdimen\trimwd        \trimwd=\pagewd
  312. \newdimen\oddleftindent \oddleftindent\z@
  313. \newdimen\evenleftindent \evenleftindent\z@
  314. \def\onecol{\colwd=\pagewd            \OneCol }
  315. \newdimen\onenarrowcolwd        \onenarrowcolwd=30pc
  316. \def\onenarrow{\colwd=\onenarrowcolwd \OneCol }
  317. %       before 5#2, `narrow' was 34pc
  318. \newdimen\onemediumcolwd        \onemediumcolwd=34pc
  319. \def\onemedium{\colwd=\onemediumcolwd  \OneCol }
  320. \newdimen\twocolcolwd           \twocolcolwd=18.75pc
  321. \def\twocol{\colwd=\twocolcolwd \intercolwd=1.5pc \TwoCol }
  322. \newdimen\threecolcolwd         \threecolcolwd=12pc
  323. \def\threecol{\colwd=\threecolcolwd \intercolwd=1.5pc \ThreeCol }
  324. \def\CenterOneCol{%
  325.   \oddleftindent\pagewd
  326.   \advance\oddleftindent -\colwd
  327.   \divide\oddleftindent\tw@
  328.   \evenleftindent\oddleftindent
  329.   \coloffset\ifodd\pageno\oddleftindent\else\evenleftindent\fi
  330. \def\OneCol{\hsize=\colwd \CenterOneCol \numcols=1 \resetmaxcols}
  331. \def\ZeroLeftIndents{\oddleftindent\z@ \evenleftindent\z@ \coloffset\z@ }
  332. \def\TwoCol{\hsize=\colwd \numcols=2 \resetmaxcols \ZeroLeftIndents}
  333. \def\ThreeCol{\hsize=\colwd \numcols=3 \resetmaxcols \ZeroLeftIndents}
  334. \def\resetmaxcols{%
  335.   \ifnum\numcols>\maxcols
  336.     \ifOverlaysinTeX \maxcols=\numcols
  337.     \else \immediate\write\sixt@@n{%
  338.       The new setting of \string\numcols is greater than \string\maxcols.^^J
  339.       Either allow overlays in TeX or increase \string\maxcols.}\fi
  340.   \fi}
  341. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  342. %                                                                            
  343. %     *****  headers/footers  *****
  344. %                                                                            
  345. \def\pagenoprefix{}
  346. \def\rtitlex{\def\tubfont{\tenpoint\rm}\TUB, \volx }
  347. \def\rtitle{%
  348.   \hbox to \pagewd{%
  349.     \tenrm
  350.     \makestrut[10pt;\z@]%
  351.     \ifodd\pageno \rtitlex\qquad\midrtitle\hfil\pagenoprefix\number\pageno
  352.     \else \pagenoprefix\number\pageno\hfil\midrtitle\qquad\rtitlex \fi
  353.     }%
  354. \def\runhead{\vbox to \rheadlgt{\rtitle \vfil }}
  355. \def\rfoot{%
  356.   \hbox to \pagewd{%
  357.     \tenrm
  358.     \makestrut[\z@;0.5pc]%
  359.     \midrtitle\hfil\midrtitle
  360.     }%
  361. \def\runfoot{\vbox to \rfootlgt{\vfil \rfoot }}
  362. %  Macros to produce extra running heads for stripping onto pages
  363. %  received as camera copy.  Format must be preset to \OneCol, and
  364. %  start on a new page.
  365. %  Generate 5 (4 + normal running head) per page.
  366. \def\DrawT@pLines{%
  367.   \vskip\topskip
  368.   \ulap{%
  369.     \line{%
  370.       \raise 1ex\rlap{\leaders\hrule\hskip\pagewd}%
  371.       \leaders\hrule\hfill
  372.       }}
  373.   \medskip}
  374. \def\r@nhead{%
  375.   \vbox to .23\vsize{%
  376.     \basezero \hsize=\pagewd \vfil
  377.     \topregister \vskip\headmargin \runhead \DrawT@pLines }
  378.   \medskip
  379.   \advancepageno }
  380. \def\nextrunner{%
  381.   \ifnum\T@stCount>0
  382.     \ifnum\T@stCount>5 \TestCount=5 \else\TestCount=\T@stCount \fi
  383.     \advance\T@stCount by-\TestCount
  384.     \DrawT@pLines           % always one at top of page
  385.     \loop\ifnum\TestCount>1 \r@nhead \advance\TestCount by\m@ne \repeat
  386.     \newpage
  387.     \def\@next{\nextrunner}%
  388.   \else \def\@next{}%
  389.   \fi
  390.   \@next }
  391. %  Use \ExtraRunheads to generate running heads for stripping (e.g. for
  392. %  author-supplied camera-ready copy).  E.g., ``\ExtraRunheads 12, {}.'' will
  393. %  generate 12 TUGboat running heads, up to 5 per page, starting with
  394. %  the current page number.
  395. \def\ExtraRunheads #1, #2.{%
  396.   \T@stCount=#1
  397.   \gdef\pageprefix{#2}%   % as in A-10 for appendices; not used just now
  398.   \nextrunner }
  399. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  400. %                                                                            
  401. %     *****  insertions  *****
  402. %                                                                            
  403. \newif\if@floatable     \@floatabletrue         % sometimes we don't want
  404. \def\nofloat{\@floatablefalse}                  % midinsertions to float
  405. % redefine \@ins to avoid the \par of PLAIN
  406. \def\@ins{\begingroup\setbox\z@\vbox\bgroup}
  407. \newinsert\botins
  408. \newif\ifp@ge \newif\if@mid \newif\if@bot
  409. \def\topinsert{\@midfalse\p@gefalse\@botfalse\@ins}
  410. \def\botinsert{\@midfalse\p@gefalse\@bottrue\@ins}
  411. \def\midinsert{\@midtrue\@botfalse\@ins}
  412. \def\pageinsert{\@midfalse\@botfalse\p@getrue\@ins}
  413. \skip\botins=\z@skip
  414. \count\botins=1000
  415. \dimen\botins=\maxdimen
  416. \def\endinsert{\egroup % finish the \vbox
  417.   \gdef\@next{}%
  418.   \if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@
  419.     \advance\dimen@12\p@ \advance\dimen@\pagetotal
  420.     \if@floatable    
  421.       \ifdim\dimen@>\pagegoal\@midfalse\@botfalse\p@gefalse\fi\fi
  422.   \fi
  423.   \if@mid
  424.     \vskip\abovedisplayskip
  425.     \box\z@
  426.     \vskip\belowdisplayskip
  427.     \gdef\@next{\@asifbelowdisplay}%
  428.   \else\insert\if@bot\botins\else\topins\fi
  429.    {\penalty100 % floating insertion
  430.     \if@bot\medskip\nobreak\fi
  431.     \splittopskip\z@skip
  432.     \splitmaxdepth\maxdimen \floatingpenalty\z@
  433.     \ifp@ge \dimen@\dp\z@
  434.       \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero
  435.     \else \box\z@\fi
  436.     \if@bot\else\medskip\fi
  437.    }%
  438.   \fi\endgroup\@next}
  439. %  Footnotes are mainly supported by PLAIN format, with these
  440. %  exceptions.
  441. \skip\footins=10pt
  442. \def\footnoterule{\kern-8pt
  443.         \hrule width 5pc \kern 7.6pt } % the \hrule is .4pt high
  444. \newif\ifDelayFirstPar          \DelayFirstParfalse
  445. \def\vfootnote#1{\ifFirstPar \DelayFirstPartrue \fi
  446.   \insert\footins\bgroup
  447.   \interlinepenalty\interfootnotelinepenalty
  448.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  449.   \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  450.   \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  451.   \rm \parindent=\normalparindent % always indent footnotes; added for TUGboat
  452.   \textindent{#1}\makestrut[10pt;\z@]\futurelet\next\fo@t}
  453. \def\@foot{\strut\egroup
  454.         \ifDelayFirstPar \SetupFirstPar \global\DelayFirstParfalse \fi }
  455. \newif\ifFirstPar       \FirstParfalse
  456. \def\SetupFirstPar{\global\parindent=\z@ \global\FirstPartrue }
  457. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  458. %                                                                            
  459. %     *****  output  *****
  460. %                                                                            
  461. %       Reorganize \pagecontents from PLAIN to put footnotes at very
  462. %       bottom of page, even if \raggedbottom.  Also add bottom insertions.
  463. \def\pagecontents{%
  464.   \ifvoid\topins\else\unvbox\topins\fi
  465.   \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
  466.   \ifr@ggedbottom \kern-\dimen@ \vfil \fi
  467.   \ifvoid\footins\else % footnote info is present
  468.     \vskip\skip\footins
  469.     \footnoterule
  470.     \unvbox\footins\fi
  471.   \ifvoid\botins\else
  472.     \vskip\skip\botins
  473.     \unvbox\botins\fi }
  474. %  Trim (registration) marks may or may not be placed around the pages;
  475. %  Overlaying may or may not be done within TeX (as opposed
  476. %  to the device driver).
  477. \newif\ifTrimmarks              \Trimmarksfalse
  478. \newif\ifOverlaysinTeX          \OverlaysinTeXtrue
  479. %  All columns containing data are formatted by \midpage.  Trim marks
  480. %  are put on all columns, but running heads only on the last column
  481. %  (i.e. column number = \numcols)
  482. \def\midpage#1{%
  483.   \vbox{
  484.     \basezero
  485.     \hrule height\z@ depth\z@ width\p@
  486.     \ifTrimmarks
  487.       \vskip-1in                % default offset for laser printers
  488.                                 % this puts top trim at edge of paper
  489.       \vbox to \trimlgt \bgroup
  490.       \topregister
  491.       \vskip \headmargin
  492.     \else
  493.       \vskip-\rheadlgt           % this puts runhead above default offset
  494.     \fi
  495.     \vbox to \pagelgt{
  496.       \ifnum\xcol=\numcols \runhead \else \vbox to \rheadlgt{}\fi
  497.       \ifThisIsFirstPage \firsthead \fi
  498.       \hbox to \pagewd{#1}       % \vsize applied in \pagebody
  499.       \ifThisIsFirstPage \firstfoot \fi
  500.       \vfil                      % if no depth, avoid underfull box
  501.       \ifnum\xcol=\numcols \runfoot \else \vbox to \rfootlgt{}\fi
  502.       }
  503.     \ifTrimmarks \vfill \botregister \egroup \fi
  504.     }}
  505. %  The production version includes trim marks, which are required
  506. %  on photographic paper, but are unsuitable for laser printer output
  507. %  (because they land at the edges of the page).  For multiple
  508. %  column output, allowance is made for column overlays either
  509. %  within TeX or by the driver.  The default is to have all
  510. %  overlays done within TeX, but large pages or matters of efficiency
  511. %  may dictate that driver-overlay is more appropriate.
  512. %  When the overlaying is done within TeX, the .dvi contains just
  513. %  one page for each page to be printed.  However, in the case
  514. %  that a driver is to do the overlaying we must anticipate that
  515. %  it will not be smart enough to properly overlay different numbers
  516. %  of .dvi pages for different printed pages (e.g. in the case that
  517. %  one job has both single- and double-column layout).  Thus, for
  518. %  each printed page, TeX constructs a constant number (=\maxcols)
  519. %  of .dvi pages.  Columns 1 through and including \numcols will
  520. %  be usual .dvi pages containing information for the typeset columns.
  521. %  Upon reaching column number \numcols, TeX will `fill out' the
  522. %  printed page with empty columns to \maxcols.
  523. %  set up auxiliary `page numbers'
  524. %  \pageno = \count0  as used in PLAIN
  525. %  \xcol is the column number within a page; ranges from 1 to \maxcols
  526. \countdef\xcol=1        \xcol=1
  527. %  \spoolno is the ordinal number of `.dvi' pages (i.e. the number
  528. %  of \shipouts performed)
  529. \countdef\spoolno=2     \spoolno=0
  530. \def\newcol{\endgraf\vfill\eject}
  531. \def\newpage{%
  532.   \vfill\eject
  533.   \loop
  534.   \ifnum\xcol>1
  535.     {\leavevmode\endgraf\vfill\eject} % \xcol is advanced in the output routine
  536.   \repeat
  537. \newcount\numcols               % `real' number of columns
  538. \newcount\@maxcolsofar          % internal counter for box allocation
  539. \@maxcolsofar=0
  540. \newcount\maxcols               % job-wide maximum number of columns
  541. \maxcols=2
  542.                                 % save the column or ship it out
  543. \def\@saveorship{%
  544.   \ifOverlaysinTeX
  545.     \ifnum\xcol>\@maxcolsofar   % if we need another column box allocated
  546.       \global\advance\@maxcolsofar\@ne
  547.       \newboxcs{column\number\xcol}%
  548.     \fi
  549.     \global\setboxcs{column\number\xcol}%
  550.   \else
  551.     \global\advance\spoolno\@ne
  552.     \shipout
  553.   \fi
  554. %  horizontal offset of column from left edge of page
  555. \newdimen\coloffset             \coloffset\z@
  556. \def\incrcoloffset{%
  557.   \global\advance\coloffset\colwd
  558.   \global\advance\coloffset\intercolwd
  559. \def\output@{%
  560.   \@saveorship\midpage{\kern\coloffset\pagebody\hfil}
  561.   \incrcoloffset
  562.   \ifnum\xcol=\numcols   % if at `real' last column, fill out page with
  563.     \loop                % empty columns
  564.     \ifnum\xcol<\maxcols
  565.       \global\advance\xcol\@ne
  566.       \@saveorship\midpage{\vbox to \collgt{}\hfil}
  567.     \repeat
  568.   \fi
  569.   \ifnum\xcol=\maxcols   % put page together if TeX is overlaying
  570.     \ifOverlaysinTeX
  571.       \global\advance\spoolno\@ne
  572.       \shipout\hbox{%
  573.         \xcol=1
  574.         \loop \rlap{\boxcs{column\number\xcol}}%
  575.         \ifnum\xcol<\maxcols
  576.           \global\advance\xcol\@ne
  577.         \repeat
  578.         \hbox to \pagewd{}%
  579.         }%
  580.     \fi
  581.     \D@EndPage          % possible shortening of next page
  582.     \global\coloffset\ifodd\pageno\oddleftindent\else\evenleftindent\fi
  583.     \global\xcol=1
  584.   \else
  585.     \global\advance\xcol\@ne
  586.   \fi
  587.   \ExecuteNextDC         % possible `Delayed Command'
  588. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  589. %                                                                            
  590. %     *****  page adjustment  *****
  591. %                                                                            
  592. %  In the absence of automatic column-balancing, provide a mechanism
  593. %  for manually shortening a specified page.
  594. \newif\ifSh@rtPage              \Sh@rtPagefalse
  595. \newif\ifSh@rtPagePending       \Sh@rtPagePendingfalse
  596. \newcount\Sh@rtPageNo
  597. \newdimen\Sh@rtPageLgt
  598. \def\@to{to}                    \def\@by{by}
  599. %       #1 = to/by; #2 = \dimen; #3 = <dimen>; #4 = * of Shorten*Page
  600. \def\@toby#1#2#3#4{%
  601.   \def\@tb{#1}%
  602.   \ifx \@tb\@to \global #2=#3
  603.   \else \ifx \@tb\@by \T@stDimen=#3         % accommodate negative #3
  604.              #2=\normalcollgt \global\advance #2 by -\T@stDimen
  605.         \else \errmessage{#1 is invalid syntax; \string\Shorten#4Page
  606.                           requires "to" or "by"}\fi
  607.   \fi }
  608. \def\@plusno#1#2;{%
  609.   \if +#1\T@stCount=\pageno \advance\T@stCount by #2
  610.   \else \T@stCount=#1#2 \fi }
  611. \def\ShortenPage #1 #2 #3. {%
  612.   \global\Sh@rtPagePendingtrue
  613.   \@plusno#1;\global\Sh@rtPageNo=\T@stCount
  614.   \@toby{#2}{\Sh@rtPageLgt}{#3}{}}
  615. \def\ShortenThisPage #1 #2. {%
  616.   \global\Sh@rtPagetrue
  617.   \@toby{#1}{\vsize}{#2}{This}}
  618. %  Two cases: 0 = last page was nonstandard; reset \vsize
  619. %             1 = do not reset \vsize: okay or length already reset
  620. \def\D@EndPage{%
  621.   \global\advancepageno
  622.   \T@stCount=1
  623.   \ifThisIsFirstPage \T@stCount=0 \global\ThisIsFirstPagefalse
  624.                      \resetfirsthead \resetfirstfoot
  625.                      \global\collgt=\normalcollgt \fi
  626.   \ifSh@rtPage \T@stCount=0 \global\Sh@rtPagefalse \fi
  627.   \ifSh@rtPagePending
  628.     \ifnum\pageno = \Sh@rtPageNo \T@stCount=1
  629.       \global\vsize=\Sh@rtPageLgt
  630.       \global\Sh@rtPagePendingfalse
  631.       \global\Sh@rtPagetrue \fi
  632.   \fi
  633.   \ifcase \T@stCount \resetpagelgt \fi }
  634. %  Add more powerful means of adjusting pages by keeping a list of
  635. %  commands to be executed prior to making up the next page.  This
  636. %  technique will be expanded in the next version of the output
  637. %  routine.
  638. %  "\DelayedCommand <page number> <column number> <command>\endCommand"
  639. %  places the token list <command> at the end of a list of "things to do".
  640. %  At the end of every column, the output routine checks this list to
  641. %  see whether the head of the list should be "executed" prior to
  642. %  building the next column.  If so, the execution is performed.
  643. %  Right now, items must be placed in the execution list in order,
  644. %  and all items for a given column must be combined into a single
  645. %  token list.
  646. %  Natural applications are double column figures and column size
  647. %  adjustments.  E.g.
  648. %  \DelayedCommand +5 1 \global\advance\vsize by 2\baselineskip\endCommand
  649. %  will increase the \vsize of the first column of the page 5 pages from
  650. %  "now" by 2 baselines.  To pull the \vsize back to normal would require
  651. %  another use of \DelayedCommand.  Double column figures can be achieved
  652. %  with insertions called by \DelayedCommand.
  653. %  Right now the technique is messy, but it can be used by those who know
  654. %  how it's implemented and know its limitations.
  655. \newtoks\@DelayedCommandList
  656. \def\DelayedCommand #1 #2 #3\endCommand{%
  657.   \@plusno#1;%
  658.   \edef\@temp{\the\@DelayedCommandList<\number\T@stCount>}%
  659.   \global\@DelayedCommandList=\expandafter{\@temp<#2>#3\endCommand}%
  660. \def\@FindNextDCPoint <#1><#2>#3\endList{%
  661.   \def\DCpage{#1}\def\DCcolumn{#2}}
  662. \def\FindNextDCPoint{%
  663.   \edef\@temp{\the\@DelayedCommandList}%
  664.   \ifx\@temp\empty \def\DCpage{\@M}\def\DCcolumn{0}%
  665.   \else
  666.     \edef\@form{%
  667.       \noexpand\@FindNextDCPoint\the\@DelayedCommandList\noexpand\endList}%
  668.     \@form
  669.   \fi}
  670. \def\@ExecuteNextDC <#1><#2>#3\endCommand#4\endList{%
  671.   \global\@DelayedCommandList={#4}%
  672.   #3}
  673. \def\ExecuteNextDC{%
  674.   \FindNextDCPoint
  675.   \ifnum \pageno=\DCpage \ifnum\xcol=\DCcolumn
  676.     \edef\@form{%
  677.       \noexpand\@ExecuteNextDC\the\@DelayedCommandList\noexpand\endList}%
  678.     \@form
  679.   \fi \fi}
  680. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  681. %     *****  general mechanism for tags  *****
  682. %  Upon sensing an opening tag (call it `\foo' here), the following process
  683. %  is set in motion:
  684. %    1. \begingroup (so definitions and settings are localized);
  685. %    2. the default situation for \foo is set up;
  686. %    3. if appropriate, an \everyfoo list is read (this allows one
  687. %       to override the TUGboat.sty factory defaults);
  688. %    4. optional commands are read.  This involves looking ahead for
  689. %       a `[' and `normalizing' the optional environment so that
  690. %       backslashes and braces are interpreted as their standard selves.
  691. %       After the options are read, the `\',`{', and `}' are restored
  692. %       to their status appropriate to \foo;
  693. %    5. the \@beginfoo macro is executed.  This
  694. %       may involve branching dependent upon flags set by options.  It may
  695. %       also be a place where spaces and carriage-returns are activated.
  696. %    6. the `argument' to \foo is read and stored or processed on
  697. %       the fly (the method employed is generally fixed for each tag).
  698. %       The argument may be delimited by *...* (called the `short-form'
  699. %       here), or up to ...\endfoo (called the `long-form').
  700. %    7. a cleanup macro is executed which also ends the current group.
  701. %       This may do all the work if an argument has been read and stored.
  702. %  Checking ahead.
  703. %  Often we check ahead to determine the next course of action.
  704. %  \@checknexttoken is used to check for optional commands, to check for the
  705. %  short-form argument-delimiter, and to ignore characters in certain
  706. %  situations.  The macro is just a check; applications must do whatever
  707. %  is appropriate with the ensuing token.
  708. %  \@checknexttoken checks the next token against argument #1.  If the
  709. %  two are the same, #2 is executed, otherwise #3.  The comparison is
  710. %  done with \ifx.  Since we check ahead with \futurelet, the first
  711. %  argument is stored with \let as well.  To include the case
  712. %  where #1 may be a space, we have to go through a small contortion
  713. %  to \let\@basetoken= that space.
  714. %  At times, the \@nexttoken will be \outer and this will prevent its
  715. %  being incorporated in the definition of \@next below.  For this reason,
  716. %  we store `\ifx\@basetoken\@nexttoken' away in a definition at a time
  717. %  when \@nexttoken is undefined and won't cause a problem.
  718. \def\if@baseis@next{\ifx\@basetoken\@nexttoken}
  719. \long\def\@checknexttoken #1#2#3{%
  720.   \futurelet\@basetoken\iffalse#1\fi
  721.   \long\def\@next{%
  722. %    \ifx \@basetoken\@nexttoken
  723.     \if@baseis@next
  724.       \long\def\@@next{#2}%
  725.     \else\long\def\@@next{#3}\fi
  726.     \@@next}%
  727.   \futurelet\@nexttoken\@next}
  728. %  Eliminating characters from input.
  729. %  The following macros check ahead to see whether the next token is a
  730. %  token to be parsed from the input stream.  \@ignoreall keeps
  731. %  checking to eliminate all such characters, whereas \@ignoreone drops
  732. %  at most one.  Argument #2 is executed after characters are eliminated.
  733. %  The token is removed by defining a control sequence whose
  734. %  contextual form includes the token.
  735.         % execute #2 after ignoring (possibly) one occurrence of #1
  736. \long\def\@ignoreone#1#2{%
  737.   \def\@ignoreform#1{#2}%
  738.   \@checknexttoken{#1}{\@ignoreform}{#2}%
  739.         % execute #2 after ignoring all occurrences of #1
  740. \long\def\@ignoreall#1#2{%
  741.   \def\@ignoreform#1{\@ignoretest}%
  742.   \def\@ignoretest{\@checknexttoken{#1}{\@ignoreform}{#2}}%
  743.   \@ignoretest
  744. %  Particularly useful ignorances.
  745.         % execute #1 after ignoring spaces
  746. \def\DeleteOptionalSpaces#1{%
  747.   \@ignoreall{ }{#1}%
  748.         % execute #1 after ignoring spaces and \pars
  749. \def\DeleteOptionalSpacesandPars#1{%
  750.   \@ignoreall{ }{\@ignoreall{\par}{#1}}%
  751. %  Checking and reading options.
  752. %  To check for the next optional argument, the macros must look
  753. %  ahead to the next character.  If the next character is a `[',
  754. %  the option-reading mechanism is invoked.  This check may be suppressed if
  755. %  the user has executed the \lastoption option.  If \@lastoption is
  756. %  "true" or if the [ is NOT next, the macro goes on to reading any
  757. %  arguments and executing appropriately.
  758. \def\@checkoptions{%
  759.   \if@lastoption
  760.     \def\@next{\@executetoend}%
  761.   \else
  762.     \def\@next{\@checknexttoken {[}{\@readoptions}{\@executetoend}}%
  763.   \fi
  764.   \@next
  765. %  Default "options" on start-up.  Unless over-ridden, the situation
  766. %  will be:
  767. %    1. there may be another option to check (i.e. \@lastoptionfalse);
  768. %    2. it will be necessary to read the input file to determine the
  769. %       method of marking arguments (i.e. \@longformfalse);
  770. %    3. arguments will be handled on the fly (i.e. \@savingargumentfalse);
  771. %    4. the long-form ending delimiter will be \end... (where ... is
  772. %       the tag with which we're currently operating.
  773. \newif\if@lastoption            \@lastoptionfalse
  774. \def\lastoption{\@lastoptiontrue}
  775. \newif\if@longform              \@longformfalse
  776. \def\longform{\@longformtrue}
  777. \newif\if@savingargument        \@savingargumentfalse
  778. \newtoks\enddelim
  779. \def\@defaultoptions{%
  780.   \@lastoptionfalse
  781.   \@longformfalse
  782.   \@savingargumentfalse
  783.   \enddelim=\expandafter{\csname end\CurrentTag\endcsname}%
  784.   \let\@long\empty
  785. %  To read an optional command, \catcodes of \ { } are restored to their plain
  786. %  values, and the [...] form is parsed out by \@@readoptions.  The argument
  787. %  to \@@readoptions is then executed, the 3 specials are restored and
  788. %  the we check again for [ after deleting spaces.  One might, alternatively,
  789. %  parse out the initial `[' and activate the `]' to end options, but
  790. %  this would make it awkward to place options within other macros (since
  791. %  the `]' would have to be \catcoded properly for the definition).
  792. \def\@readoptions{%
  793.   \savecat\\\makeescape\\%
  794.   \savecat\{\makebgroup\{%
  795.   \savecat\}\makeegroup\}%
  796.   \@@readoptions}
  797. \def\@@readoptions[#1]{%
  798.   #1%
  799.   \restorecat\\\restorecat\{\restorecat\}%
  800.   \DeleteOptionalSpaces{\@checkoptions}%
  801. %  Short Form Tagging.
  802. %  We specify a character (*) to be used as a begin/end delimiter
  803. %  for the argument to most tags.  This code could be copied and
  804. %  altered a bit to use another character.
  805. %  The character will be encountered as either type `other' or as
  806. %  an `active' character.
  807. \newtoks\@otherSFD
  808. \@otherSFD={*}
  809. \let\@SFD=*                     % used in \@checknexttoken
  810. \newtoks\@activeSFD
  811. {\makeactive\*
  812.   \global\@activeSFD={*}%
  813. \let\@plainast=\ast
  814. \def\ast{\ifmmode\@plainast\else *\fi}
  815. %  Reading to the end-tag.
  816. %  Macros may just do their business after options have been
  817. %  read.  In this case, there is no end-tag to worry about.
  818. %  Otherwise, the macros either read to the "long-form" of end-tag
  819. %  (e.g. \endtitle or \endauthor) or to the short-form (assumed to
  820. %  be * here).  Unless an option has specified
  821. %  that the long-form is to be used, the macros look ahead to
  822. %  see whether the short-form delimiter occurs next.  If so,
  823. %  it is assumed that the short-form is being used.  In any case,
  824. %  the appropriate \@begin... macro is executed before the argument is
  825. %  handled.
  826. \newcount\@numarguments         \@numarguments=1
  827. \def\@executetoend{%
  828.   \ifnum\@numarguments>0
  829.     \if@longform \def\@afterbegintag{\@longparse}%
  830.     \else
  831.       \def\@afterbegintag{\@checknexttoken
  832.                   {\@SFD}{\@shortparse}{\@longparse}}%
  833.     \fi
  834.   \else
  835.     \def\@afterbegintag{}%
  836.   \fi
  837.   \csname @begin\CurrentTag\endcsname
  838.   \@afterbegintag
  839. %  If the short-form is being used and an argument is to be saved,
  840. %  we must define a "form" which TeX may follow to pull out the
  841. %  tag's argument.  The argument is stored away in the token register
  842. %  \@argument, and the appropriate end-operation is performed.
  843. %  Otherwise (the `argument' is processed on-the-fly), we parse out
  844. %  the initial short-form delimiter and activate the ending one.
  845. \newtoks\@argument
  846. \def\@shortparse{%
  847.   \if@savingargument
  848.     \edef\@form{%
  849.       \def\noexpand\@@shortparse\the\@otherSFD####1\the\@otherSFD}%
  850.     \@long\@form{\@argument{##1}\csname end\CurrentTag\endcsname}%
  851.   \else
  852.     \expandafter\makeactive\csname\the\@otherSFD\endcsname
  853.     \expandafter\def\the\@activeSFD
  854.       {\csname end\CurrentTag\endcsname
  855.        \expandafter\makeother\csname\the\@otherSFD\endcsname}%
  856.     \def\@@shortparse{%
  857.       \expandafter\@ignoreone\expandafter{\the\@otherSFD}%
  858.         {}%
  859.       }%
  860.   \fi
  861.   \@@shortparse}
  862. %  On the other hand, if the long form is used, TeX must parse to
  863. %  the long-form ending tag.  Ordinarily we know the ending-tag
  864. %  because it is just the \end... which corresponds to the tag
  865. %  which initiated the process.  We do allow for the possibility,
  866. %  however, that we may want to switch this for some reason. E.g.
  867. %  the different \verbatim styles allow for \verbatim...\endverbatim
  868. %  and ||...||.  The easiest way to implement the || style is
  869. %  to have the first || call \verbatim and have \verbatim know
  870. %  to look for || as the end-tag instead of \endverbatim.  This may
  871. %  be accomplished by allowing for the possibility of different
  872. %  end-tags as below.
  873. \def\@longparse{%
  874.   \if@savingargument
  875.     \edef\@form{\def\noexpand\@@longparse####1\the\enddelim}%
  876.     \@long\@form{\@argument{##1}\csname end\CurrentTag\endcsname}%
  877.   \else \def\@@longparse{}\fi
  878.   \@@longparse
  879. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  880. %  Macros generally available to tags.
  881. \def\longargument{\def\@long{\long}}
  882. \def\@authorstyle{\@@@a}
  883. \def\@inlinestyle{\@@@i}
  884. \def\@displaystyle{\@@@d}
  885. \def\@altinlinestyle{}
  886. \def\@altdisplaystyle{}
  887. \newif\if@removeprewhite        \@removeprewhitefalse
  888. \newif\if@removepostwhite       \@removepostwhitefalse
  889. \def\removeprewhite{\@removeprewhitetrue}
  890. \def\removepostwhite{\@removepostwhitetrue}
  891. %  Allow for line numbers on a listing as well as rules above and below.
  892. \newif\if@ruled         \@ruledfalse
  893. \newif\if@numbered      \@numberedfalse
  894. \newcount\linenumber
  895. \newcount\globallinenumber      \globallinenumber = 0
  896. \newif\if@continuingnumbers \@continuingnumbersfalse
  897. \def\continuenumbers{\numbered\@continuingnumberstrue}
  898. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  899. %     *****  title, section title, authors, addresses  *****
  900. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  901. %  title
  902. \def\title{%
  903.   \begingroup
  904.   \def\CurrentTag{title}%
  905.   \@defaultoptions
  906.   \@savingargumenttrue
  907.   \@checkoptions}
  908. \def\endtitle{%
  909.   \global\toks@=\expandafter{\the\@argument}%
  910.   \endgroup
  911.   \edef\thetitle{\ignorespaces\the\toks@\unskip}%
  912. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  913. %  section titles
  914. %  Material mostly in tugboat.com now
  915. \setbox\T@stBox=\hbox{\sectitlefont O}
  916. \newdimen\stfontheight          \stfontheight=\ht\T@stBox
  917. \def\sectitle{%
  918.   \begingroup
  919.   \def\CurrentTag{sectitle}%
  920.   \@defaultoptions
  921.   \@savingargumenttrue
  922.   \global\SecTitletrue
  923.   \@checkoptions}
  924. \def\endsectitle{%
  925.   \@sectitle{\the\@argument}%
  926.   \endgroup
  927. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  928. %  authors
  929. \newcount\authornumber
  930. \def\author{%
  931.   \begingroup
  932.   \def\CurrentTag{author}%
  933.   \global\advance\authornumber by 1
  934.   \@defaultoptions
  935.   \@savingargumenttrue
  936.   \@checkoptions}
  937. \def\endauthor{%
  938.   \global\toks@=\expandafter{\the\@argument}%
  939.   \endgroup
  940.   \expandafter\edef\csname theauthor\number\authornumber\endcsname
  941.       {\ignorespaces\the\toks@\unskip}%
  942.   \expandafter\let\csname theaddress\number\authornumber\endcsname\relax
  943.   \expandafter\let\csname thenetaddress\number\authornumber\endcsname\relax
  944. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  945. %  addresses
  946. \def\address{%
  947.   \begingroup
  948.   \def\CurrentTag{address}%
  949.   \@defaultoptions
  950.   \@savingargumenttrue
  951.   \let\@addressstyle=\@authorstyle
  952.   \def\inline{\let\@addressstyle=\@inlinestyle}%
  953.   \def\display{\let\@addressstyle=\@displaystyle}%
  954.   \@checkoptions}
  955. \def\endaddress{%
  956.   \ifx\@addressstyle\@inlinestyle
  957.     \def\\{, }\the\@argument
  958.     \endgroup
  959.     \def\@next{}%
  960.   \else\ifx\@addressstyle\@displaystyle
  961.     \endgraf\raggedright
  962.     \everypar={\hangindent 1.5\parindent}%
  963.     \def\\{\endgraf}%
  964.     \def\|{\unskip\hfil\break}%
  965.     \vskip\abovedisplayskip
  966.     \the\@argument\endgraf
  967.     \vskip\belowdisplayskip
  968.     \@asifbelowdisplay
  969.     \endgroup
  970.     \def\@next{\ignorespaces}%
  971.   \else
  972.     \global\toks@=\expandafter{\the\@argument}%
  973.     \endgroup
  974.     \expandafter\edef\csname theaddress\number\authornumber\endcsname
  975.       {\ignorespaces\the\toks@\unskip}%
  976.     \def\@next{}%
  977.   \fi \fi
  978.   \@next
  979. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  980. %  network addresses
  981. \def\netaddress{%
  982.   \begingroup
  983.   \def\CurrentTag{netaddress}%
  984.   \@defaultoptions
  985.   \@savingargumenttrue
  986.   \let\@network\relax
  987.   \def\network##1{\def\@network{##1: }}%
  988.   \@SpecialsGetOther
  989.   \makeescape\\%
  990.   \netaddrat
  991.   \netaddrpercent
  992.   \@checkoptions}
  993. {\makeactive\@
  994.  \gdef\netaddrat{\makeactive\@\def@{\char"40\discretionary{}{}{}}}
  995.  \makeactive\%
  996.  \gdef\netaddrpercent{\makeactive\%\def%{\char"25\discretionary{}{}{}}}
  997. %  We want the definition of \thenetaddress... to land at the right
  998. %  nesting level, so we have to first pull it to the top, then
  999. %  drop back to where we are.
  1000. \def\endnetaddress{%
  1001.   \global\toks@=\expandafter{\the\@argument}%
  1002.   \ifx\@network\relax
  1003.     \gdef\@@network{}%
  1004.   \else
  1005.     \xdef\@@network{\@network}%
  1006.   \fi
  1007.   \endgroup
  1008.   \expandafter\edef\csname thenetaddress\number\authornumber\endcsname
  1009.     {{\noexpand\rm\@@network}%
  1010.      {\noexpand\netaddrat\noexpand\netaddrpercent\noexpand\net
  1011.       \ignorespaces\the\toks@\unskip}}%
  1012. \def\net{\tt}
  1013. %  Overrides to default author and signature formats
  1014. \def\authorlist#1{\def\@authorlist{#1}}
  1015. %  Except for the first article in a section, beginnings of articles
  1016. %  are announced by a horizontal rule the width of the column.
  1017. %  In the case that this rule happens to fall at the top of a column,
  1018. %  we have to make sure that it appears at the VERY top of the column
  1019. %  and not just on the first baseline.  To accomplish this, we insert
  1020. %  an empty rule first and then jump back over it to place the rule that
  1021. %  readers will see.
  1022. \def\article{%
  1023.   \@allowspanningfigsfalse
  1024.   \ifSecTitle \global\SecTitlefalse
  1025.   \else \vskip\AboveTitleSkip
  1026.     \kern\topskip
  1027.     \nullhrule
  1028.     \kern-\topskip
  1029.     \kern-\strulethickness
  1030.     \hrule height\strulethickness depth\z@
  1031.     \nobreak
  1032.     \kern\medskipamount
  1033.   \fi
  1034.   \ifx\thetitle\relax
  1035.   \else
  1036.     \nobreak
  1037.     {\parskip\z@
  1038.       \noindent\def\\{\unskip\break}\raggedstretch=.3\colwd\raggedright\bf
  1039.       \ignorespaces\thetitle\unskip\endgraf}%
  1040.   \fi
  1041.   \ifnum\authornumber>0
  1042.     \nobreak
  1043.     \vskip4pt
  1044.     {\parskip\z@
  1045.      \def\\{\unskip\hfil\break}\hangindent\parindent\raggedright
  1046.      \@authorlist\endgraf}
  1047.   \fi
  1048.   \nobreak
  1049.   \vskip \BelowTitleSkip
  1050.   \vskip -\parskip
  1051.   \tenpoint
  1052.   \DeleteOptionalSpacesandPars{\noindent\ignorespaces}%
  1053. \def\endarticle{\vfil\end}              % redefined in drivers
  1054. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1055. %     *****  heads  *****
  1056. %  Heads are set by first saving the text of the head in \@argument
  1057. %  and then operating appropriately depending upon the \headlevel.
  1058. %  Selection among the different heads is made by an \ifcase.
  1059. %  To remove extra \par tokens between heads and ensuing text in the
  1060. %  input file, we call \DeleteOptionalSpacesandPars.  To do this outside
  1061. %  the `head' group and just before TeX returns to the normal input stream
  1062. %  following a call to \head, we must define (globally) a control sequence
  1063. %  (\@next) and call it at the very end.
  1064. \newcount\headlevel     \headlevel=1
  1065. \def\head{%
  1066.   \begingroup
  1067.   \def\CurrentTag{head}%
  1068.   \@allowindentfalse
  1069.   \@defaultoptions
  1070.   \@savingargumenttrue
  1071.   \def\\{\break}%
  1072.   \@checkoptions}
  1073. \def\endhead{%
  1074.   \endgraf
  1075.   \ifcase\headlevel\or\@domainhead\or\@dosubhead\or\@dosubsubhead\fi
  1076.   \endgroup
  1077.   \@next
  1078. \def\@domainhead{%
  1079.   \if@removeprewhite\else\vskip\baselineskip\fi
  1080.   \noindent{\raggedright\bf\ignorespaces\the\@argument\unskip\endgraf}%
  1081.   \if@removepostwhite          %  usually we want the white space
  1082.   \else\kern0.5\baselineskip\fi
  1083.   \nobreak
  1084.   \gdef\@next{%
  1085.     \if@allowindent\def\@next{}%  usually we don't want to indent here
  1086.     \else\def\@next{\DeleteOptionalSpacesandPars{\noindent\ignorespaces}}\fi
  1087.     \@next
  1088.     }%
  1089. \def\@dosubhead{%
  1090.   \if@removeprewhite\else\medskip\fi
  1091.   \noindent{\frenchspacing\bf\ignorespaces\the\@argument
  1092.     \unskip\if@headpunctuation.\fi}%
  1093.     \hskip 0.5em plus \fontdimen3\the\font
  1094.   \gdef\@next{\DeleteOptionalSpacesandPars{}}%
  1095. \def\@dosubsubhead{%
  1096.   {\frenchspacing\bf\ignorespaces\the\@argument\unskip}%
  1097.     \hskip 0.5em plus \fontdimen3\the\font
  1098.   \gdef\@next{\DeleteOptionalSpacesandPars{}}%
  1099. \def\subhead{\head[\headlevel=2]}
  1100. \def\subsubhead{\head[\headlevel=3]}
  1101. \newif\if@headpunctuation  \@headpunctuationtrue
  1102. \def\nopunctuation{\@headpunctuationfalse}
  1103. \newif\if@allowindent
  1104. \def\allowindent{\global\@allowindenttrue}
  1105. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1106. %     *****  text and subtext  *****
  1107. %  The code here exists primarily to implement \subtext.  The treatment
  1108. %  is similar to that for \head in that an \ifcase statement is called
  1109. %  to choose between the various text levels.  Here, however, we handle
  1110. %  the `text' on the fly instead of saving it as an argument.
  1111. \newcount\textlevel     \textlevel=1
  1112. \def\text{%
  1113.   \begingroup
  1114.   \def\CurrentTag{text}%
  1115.   \@defaultoptions
  1116.   \@savingargumentfalse
  1117.   \@checkoptions}
  1118. \def\@begintext{%
  1119.   \endgraf
  1120.   \ifcase\textlevel\or\or\@setupsubtext\fi
  1121. \def\@setupsubtext{%
  1122.   \vskip\abovedisplayskip
  1123.   \advance\leftskip by 0.5\parindent
  1124.   \advance\rightskip by 0.5\parindent
  1125.   \ninepoint\rm
  1126. \def\endtext{%
  1127.   \gdef\@next{}%
  1128.   \ifcase\textlevel\or\or\@dosubtext\fi
  1129.   \endgroup
  1130.   \@next
  1131. \def\@dosubtext{%
  1132.   \endgraf
  1133.   \vskip\belowdisplayskip
  1134.   \gdef\@next{\@asifbelowdisplay}%
  1135. \def\subtext{\text[\textlevel=2]}
  1136. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1137. %     *****  lists  *****
  1138. \newcount\listlevel     \listlevel=1
  1139. \newif\if@itemized
  1140. \newcount\itemnumber
  1141. \newtoks\@itemtag
  1142. \newcount\@cols                 % number of columns in list
  1143. \newdimen\colsepwidth
  1144. \newdimen\@listindent
  1145. \newdimen\@listhangindent
  1146. \newif\if@firstitem             % when first item is handled differently
  1147. \newtoks\everylist
  1148. \def\list{%
  1149.   \begingroup
  1150.   \def\CurrentTag{list}%
  1151.   \let\@liststyle=\@displaystyle
  1152.   \def\inline{\let\@liststyle=\@inlinestyle}%
  1153.   \def\display{\let\@liststyle=\@displaystyle}%
  1154.   \def\displaystyle##1{\def\@altdisplaystyle{##1}}%
  1155.   \def\inlinestyle##1{\def\@altinlinestyle{##1}}%
  1156.   \def\item{%
  1157.     \begingroup
  1158.     \def\CurrentTag{item}%
  1159.     \@numarguments=0
  1160.     \@checkoptions}%
  1161.   \@itemtag={$\bullet$}%
  1162.   \def\tag##1{\@itemtag{##1}}%
  1163.   \def\tagform##1{\llap{##1\strutt\enspace}}%
  1164.   \@itemizedtrue
  1165.   \def\unitemized{\@itemizedfalse}%
  1166.   \itemnumber=0
  1167.   \def\numbered{\@itemtag={\number\itemnumber.}}%
  1168.   \def\romannumeraled{\@itemtag={\romannumeral\itemnumber.}}%
  1169.   \def\Romannumeraled{\@itemtag=
  1170.     {\uppercase\expandafter{\romannumeral\itemnumber.}}}%
  1171.   \def\lettered{\itemnumber="60 \@itemtag={\char\itemnumber.}}%
  1172.   \def\Lettered{\itemnumber="40 \@itemtag={\char\itemnumber.}}%
  1173.   \def\ruled{\@ruledtrue}%
  1174.   \@ruledfalse
  1175.   \@cols=1
  1176.   \def\cols{\@cols}%
  1177.   \@firstitemtrue
  1178.   \def\@itemseparator{, }%
  1179.   \def\itemseparator##1{\def\@itemseparator{##1}}%
  1180.   \@defaultoptions
  1181.   \@savingargumentfalse
  1182.   \the\everylist
  1183.   \@checkoptions}
  1184. \def\@beginlist{%
  1185.   \ifx\@liststyle\@displaystyle
  1186.     \endgraf
  1187.     \ifnum\listlevel=1
  1188.       \if@ruled \if@removeprewhite\else\medskip\fi \hrule\kern5pt \nobreak
  1189.       \else \if@removeprewhite\else\vskip\abovedisplayskip \fi\fi
  1190.     \fi
  1191.     \advance\leftskip\parindent
  1192.     \@listindent=\parindent
  1193.     \@listhangindent=\@listindent
  1194.     \parindent\@listindent
  1195.     \lineskip\z@
  1196.     \if@itemized
  1197.     \else
  1198.       \parskip\z@skip
  1199.       \parindent\z@
  1200.       \raggedright
  1201.       \everypar={\advance\itemnumber\@ne
  1202.                  \tagform{\the\@itemtag}}%
  1203.       \makeCtrlMendgraf
  1204.     \fi
  1205.     \def\colsep{%
  1206.       \global\count@\itemnumber
  1207.       \egroup\kern\colsepwidth
  1208.       \vtop\bgroup
  1209.       \@altdisplaystyle
  1210.       \itemnumber=\count@\ignoreendline}%
  1211.     \ifnum\@cols>1
  1212.       \dimen@\colsepwidth
  1213.       \multiply\dimen@\@cols
  1214.       \advance\dimen@-\colsepwidth
  1215.       \advance\hsize-\dimen@
  1216.       \divide\hsize by\@cols
  1217.       \hbox\bgroup\vtop\bgroup
  1218.     \fi
  1219.     \@altdisplaystyle
  1220.   \else
  1221.     \def\tagform##1{##1\strutt\ }%
  1222.     \if@itemized
  1223.     \else
  1224.        \makeCtrlMseparator
  1225.        \advance\itemnumber by \@ne
  1226.        \tagform{\the\@itemtag}%
  1227.     \fi
  1228.     \def\colsep{}%
  1229.     \@altinlinestyle
  1230.   \fi
  1231. \def\endlist{%
  1232.   \ifx\@liststyle\@displaystyle
  1233.     \if@itemized\endgraf\fi
  1234.     \ifnum\@cols>1
  1235.       \egroup   % vtop
  1236.       \egroup   % hbox
  1237.     \fi
  1238.     \ifnum\listlevel=1
  1239.       \if@ruled \kern5pt\hrule\nobreak\vskip2\medskipamount
  1240.       \else %\nobreak
  1241.         \if@removepostwhite\else\vskip\belowdisplayskip\fi
  1242.       \fi
  1243.       \gdef\@next{\@asifbelowdisplay}%
  1244.     \fi
  1245.   \else \gdef\@next{}%
  1246.   \fi
  1247.   \endgroup     % list
  1248.   \@next
  1249. \def\sublist{\list[\listlevel=2]}
  1250. \newtoks\everyitem      \everyitem{}
  1251. \def\@beginitem{%
  1252.   \ifx\@liststyle\@displaystyle
  1253.     \endgraf
  1254.     \if@firstitem\@firstitemfalse\else\vskip\smallskipamount\fi
  1255.     \advance\itemnumber by \@ne
  1256.     \noindent\leavevmode
  1257.     \the\everyitem
  1258.     \tagform{\the\@itemtag}%
  1259.   \else
  1260.     \def\item{\if@firstitem\@firstitemfalse\else\unskip\@itemseparator\fi
  1261.               \advance\itemnumber by \@ne\the\@itemtag\enspace}%
  1262.   \fi  
  1263.   \global\count@\itemnumber
  1264.   \global\dimen@\hangindent
  1265.   \endgroup
  1266.   \itemnumber\count@
  1267.   \hangindent\dimen@
  1268. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1269. %     *****  verbatim  *****
  1270. %  Operation here is very similar to that for the other tags.
  1271. %  The opening tag sets up the situation and looks for optional
  1272. %  commands and the short-form delimiters.  Since initial setup
  1273. %  involves changing the special characters to characters of
  1274. %  type other, some juggling must be done when optional commands
  1275. %  are read.  In addition, to allow for implementation of the
  1276. %  |...| style using the more verbose \verbatim...\endverbatim,
  1277. %  we parameterize the ending-delimiter.
  1278.         % sets default to display style
  1279. \def\verbatim{\@verbatim[\display]}
  1280. \def\@verbatim{%
  1281.   \begingroup
  1282.   \setupverbatim
  1283.   \@checkoptions
  1284. \def\setupverbatim{%
  1285.   \def\CurrentTag{verbatim}%
  1286.   \@defaultoptions
  1287.   \def\inline{\let\@verbstyle\@inlinestyle}%
  1288.   \def\display{\let\@verbstyle\@displaystyle}%
  1289.   \def\displaystyle##1{\def\@altdisplaystyle{##1}}%
  1290.   \def\inlinestyle##1{\def\@altinlinestyle{##1}}%
  1291.   \def\numbered{\@numberedtrue}%
  1292.   \def\ruled{\@ruledtrue}%
  1293.   \def\smallcode{\ninepoint\tt\baselineskip=10pt}%
  1294.   \let\@verbinputvar\relax
  1295.   \let\@verbinputfile\relax
  1296.   \@SpecialsGetOther
  1297.   \enddelim=\expandafter{\endverbdelimiter}%
  1298.   \normalspaces\frenchspacing
  1299.   \obeylines
  1300.   \@savingargumenttrue
  1301.   \the\everyverbatim
  1302. \def\@SpecialsGetOther{%
  1303.   \catcode`\\=\other
  1304.   \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other
  1305.   \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other
  1306.   \catcode`\~=\other \catcode`\_=\other \catcode`\^=\other
  1307.   \the\@AdditionsToSpecialsGetOther}
  1308. %  The \@Additions... register above should be used whenever another
  1309. %  character is declared to be special for some purpose.  E.g.,
  1310. %  we will use the | for the short-form |...| verbatim notation.
  1311. %  Since the | is generally active for this purpose, it's category
  1312. %  won't get changed to \other for use in \verbatim...\endverbatim
  1313. %  unless we add it via this mechanism.
  1314. \newtoks\@AdditionsToSpecialsGetOther
  1315. \def\AddToSpecialsGetOther#1{%
  1316.   \@AdditionsToSpecialsGetOther=
  1317.    \expandafter{\the\@AdditionsToSpecialsGetOther#1}}
  1318. %  Altering the verbatim setup.
  1319. %  Users can alter the setup to their purpose by
  1320. %  putting tokens in the register \everyverbatim.
  1321. \newtoks\everyverbatim
  1322. %  Ordinarily the end-tag would be the single token `\endverbatim'.
  1323. %  The following allows us to `see' the tag when `\' is of type `other'.
  1324. {\catcode`\|=0 \catcode`\\=\other
  1325. |gdef|endverbdelimiter{\endverbatim}}
  1326. %  Input from an external variable or file
  1327. \def\inputfromvar#1{\def\@verbinputvar{#1}}%
  1328. \def\inputfromfile#1{\def\@verbinputfile{#1}}%
  1329. \let\@verbinputvar\relax
  1330. \let\@verbinputfile\relax
  1331. %  Outputs
  1332. \newif\if@outputtotype  \@outputtotypetrue
  1333. \def\notype{\@outputtotypefalse}
  1334. \def\outputtovar#1{\def\@verboutputvar{#1}}
  1335. \def\outputtofile#1{\def\@verboutputfile{#1}}
  1336. \let\@verboutputvar\relax
  1337. \let\@verboutputfile\relax
  1338. \newwrite\verboutfile
  1339. \def\@beginverbatim{\obeyspaces}%\obeylines}
  1340. \def\endverbatim{%
  1341.  \ifx\@verboutputvar\relax\else         % output to `variable'
  1342.    \expandafter\xdef\csname\@verboutputvar\endcsname{\the\@argument}%
  1343.  \ifx\@verboutputfile\relax\else        % output to file
  1344.    \immediate\openout\verboutfile=\@verboutputfile
  1345.    \makeCtrlMnewlinechar
  1346.    \iffalse{\fi\expandafter\@setupverbwrite\the\@argument}% use \@setupwrite to
  1347.    \immediate\closeout\verboutfile              % get rid of initial ^^M
  1348.  \gdef\@next{}%                         % in case following clause is false
  1349.  \if@outputtotype                       % output typeset on page
  1350.   \tt
  1351.   \ifx\@verbstyle\@inlinestyle
  1352.     \@beforeverbinline
  1353.     \@altinlinestyle
  1354.   \else
  1355.     \@beforeverbdisplay
  1356.     \@altdisplaystyle
  1357.   \fi
  1358.   \ifx\@verbinputvar\relax\else         % input from `variable'
  1359.     \csname\@verbinputvar\endcsname
  1360.   \fi
  1361.   \ifx\@verbinputfile\relax\else        % input from file
  1362.     \fileinput{\@verbinputfile}%
  1363.     \@endverbatim
  1364.   \fi
  1365.   \expandafter\@ignoreCtrlMverbendline\the\@argument\@endverbatim
  1366.   \ifx\@verbstyle\@inlinestyle
  1367.     \@afterverbinline
  1368.   \else
  1369.     \@afterverbdisplay\gdef\@next{\@asifbelowdisplay}%
  1370.   \fi
  1371.  \endgroup
  1372.  \@next
  1373. \def\@beforeverbinline{%
  1374.     \makeCtrlMverbspace
  1375.     \let\@endverbatim=\empty
  1376. \def\@beforeverbdisplay{%
  1377.   \def\@endverbatim{\verbendline}%
  1378.   \if@ruled \medskip \hrule\kern5pt \nobreak
  1379.   \else \vskip\abovedisplayskip
  1380.   \fi
  1381.   \makespaceverbspace
  1382.   \makeCtrlMverbendline
  1383.   \parskip=\z@skip
  1384.   \if@numbered \parindent=\z@
  1385.     \if@continuingnumbers
  1386.     \else \global\globallinenumber = \z@ \fi
  1387.     \linenumber=\z@ \fi
  1388.   \everypar={\global\advance\globallinenumber by\@ne
  1389.           \advance\linenumber by\@ne
  1390.           \ifnum\linenumber<3 \vadjust{\nobreak}\fi
  1391.           \if@numbered \leavevmode
  1392.               \hbox to\normalparindent{\hss\sevenrm\the\globallinenumber.\ }%
  1393.           \fi}%
  1394.   \frenchspacing\rightskip=-\ttrightskip \hyphenpenalty\@M
  1395. %  \ttrightskip is the permissible overhang beyond right margin;
  1396. %  in MANMAC, this is 5pc, which is fine for the TeXbook, but too much here.
  1397. \newdimen\ttrightskip   \ttrightskip=1pc
  1398. \def\@afterverbinline{}
  1399. \def\@afterverbdisplay{%
  1400.   \if@ruled \kern5pt\hrule\fi
  1401.   \ifnum\linenumber<3 \penalty\z@ \fi
  1402.   \if@removepostwhite\else
  1403.     \if@ruled \vskip2\medskipamount \else \vskip\belowdisplayskip\fi
  1404.   \fi
  1405. \def\@asifbelowdisplay{%
  1406.   \toks@=\expandafter{\the\everypar}%
  1407.   \noindent
  1408.   \everypar=\expandafter{\the\toks@}%
  1409.   \ignorespaces}
  1410. %  Definitions of spaces and ^^M
  1411. %  \@ignoreCtrlMverbendline is used to lop off an initial ^^M in
  1412. %  verbatim text and to remove an \@endverbatim (the latter in case the
  1413. %  verbatim text is actually empty)
  1414. \def\@ignoreendverbatim{\@ignoreone{\@endverbatim}{}}
  1415. \def\verbendline{\leavevmode\null\endgraf}
  1416. \def\makeCtrlMactive{\catcode`\^^M=\active}
  1417. {\makeCtrlMactive
  1418. \gdef\makeCtrlMverbendline{\makeCtrlMactive%
  1419.  \def^^M{\@ignoreone{\@endverbatim}{\verbendline}}}%
  1420. \makeCtrlMverbendline%
  1421. \gdef\@ignoreCtrlMverbendline{\@ignoreone{
  1422. }{\@ignoreendverbatim}}%
  1423. \gdef\@setupverbwrite{\@ignoreone{
  1424. }{\immediate\write\verboutfile\bgroup}}%
  1425. \gdef\makeCtrlMverbspace{\makeCtrlMactive\def^^M{\verbatimspace}}%
  1426. \gdef\makeCtrlMnewlinechar{\newlinechar=`\^^M}%
  1427. \gdef\makeCtrlMendgraf{\makeCtrlMactive\def^^M{\strutt\endgraf}}%
  1428. \gdef\makeCtrlMseparator{\makeCtrlMactive%
  1429.   \def^^M{%
  1430.     \@checknexttoken {\endlist}{}{%
  1431.       \@itemseparator\advance\itemnumber by \@ne \tagform{\the\@itemtag}%
  1432.       \ignorespaces}}}%
  1433. %  to read a variable or file name properly, we must interpret
  1434. %  spaces and ^^M as nothing or as spaces
  1435. {\makeCtrlMactive\obeyspaces%
  1436. \gdef\makeCtrlMempty{\def^^M{}}%
  1437. \gdef\makespaceempty{\def {}}%
  1438. {\makeCtrlMactive\obeyspaces%
  1439. \gdef\makeCtrlMspace{\def^^M{\space}}%
  1440. \gdef\makespacespace{\def {\space}}%
  1441. {\makeCtrlMactive%
  1442. \gdef\@ignoreCtrlM#1{\@ignoreone{^^M}{#1}}%
  1443. \gdef\ignoreendline{\@ignoreCtrlM{}}%
  1444. %  From David Eppstein's ``Trees'' paper (6#1), preserve initial spaces.
  1445. \def\verbatimspace{\ifvmode\indent\fi\space}
  1446. {\obeyspaces\gdef\makespaceverbspace{\def {\verbatimspace}}}
  1447. %  Options and variants.
  1448. \def\verbinline{\verbatim[\inline]}
  1449. \def\verbdisplay{\verbatim[\display]}
  1450. \def\verbfile#1{\verbatim[\inputfromfile{#1}]}
  1451. %  Verbatim with the other characters (e.g. |...|).
  1452. %  Procedures are parameterized so that it is easy to allow
  1453. %  different characters to perform this function.  Any character
  1454. %  that's chosen could cause problems if it occurs unexpectedly
  1455. %  in the middle of what is supposed to be verbatim text.  We call
  1456. %  the current special character for this purpose the "verbchar"
  1457. %  and store it in active form in the token register \@verbchar.
  1458. \newtoks\@verbchar
  1459. %  On hitting a "verbchar" in the middle of text, TeX must look ahead
  1460. %  to see whether the verbchar occurs again.  Since this
  1461. %  look-ahead fixes the category of the token examined, we must change
  1462. %  the categories of all characters appropriately before looking
  1463. %  (and we read \everyverbatim in case it contains a category change).
  1464. %  We must also "gobble" the second verbchar if we hit one.
  1465. %  Depending upon whether 1 or 2 verbchars are found, we call
  1466. %  \verbatim with the appropriate style command.  We also use an
  1467. %  optional command to change the delimiter which ends this \verbatim
  1468. %  block.  We naturally localize the changes to category codes made on
  1469. %  startup.  It's easier to end this group here at the beginning and to
  1470. %  restart everything in a standard \verbatim than it is to add an extra
  1471. %  \endgroup after the verbatim text.
  1472. \def\@firstverbchar{%
  1473.   \begingroup
  1474.   \setupverbatim
  1475. %  \@SpecialsGetOther
  1476.   \makeverbcharactive
  1477.   \expandafter\@checknexttoken\expandafter{\the\@verbchar}%
  1478.     {\expandafter\@ignoreone\expandafter{\the\@verbchar}%
  1479.       {\endgroup\verbatim[\longform\maketwoendverb]}}%
  1480.     {\endgroup\verbatim[\inline\longform\makeoneendverb]}%
  1481. \def\setupverbchar{%
  1482.  \def\makeoneendverb{\catcode\expandafter`\csname\expandafter
  1483.         \string\the\@verbchar\endcsname=
  1484.     \active\edef\endverbdelimiter{\the\@verbchar}%
  1485.     \enddelim=\expandafter{\endverbdelimiter}}%
  1486.   \def\maketwoendverb{\catcode\expandafter`\csname\expandafter
  1487.         \string\the\@verbchar\endcsname=
  1488.     \active\edef\endverbdelimiter{\the\@verbchar\the\@verbchar}%
  1489.     \enddelim=\expandafter{\endverbdelimiter}}%
  1490.   \expandafter\let\the\@verbchar\@firstverbchar
  1491.   \makeverbcharactive
  1492.   \AddToSpecialsGetOther{%
  1493.     \catcode\expandafter`\csname
  1494.         \expandafter\string\the\@verbchar\endcsname=\other}%
  1495. \def\makeverbcharactive{%
  1496.   \catcode\expandafter`\csname
  1497.         \expandafter\string\the\@verbchar\endcsname=\active}
  1498. {\makeother\| \gdef\VertChar{|}}
  1499. {\makeactive\|
  1500. \gdef\makevertverbchar{%
  1501.   \@verbchar={|}%
  1502.   \setupverbchar
  1503. {\makeother\! \gdef\WowChar{!}}
  1504. {\makeactive\!
  1505. \gdef\makewowverbchar{%
  1506.   \@verbchar={!}%
  1507.   \setupverbchar
  1508. \def\MTH{$}
  1509. \def\sb{_}
  1510. \def\sp{^}
  1511. \def\SP{{\tt\char"20 }}         % "visible" space
  1512. \chardef\bs=`\\
  1513. \def\vrt{{\tt\char`\|}}
  1514. \def\brokenvert{\hbox to 5.24998pt{\hfill
  1515.   \lower 1.5pt\vbox to 8.5pt{\hrule width .9pt height 3.25pt
  1516.   \vfill\hrule width .9pt height 3.25pt}\hfill}}
  1517. \def\@lt{$<$}
  1518. \def\@gt{$>$}
  1519. {\makeactive\<
  1520. \gdef\enablemetacode{%
  1521.   \AddToSpecialsGetOther{\catcode`\<=\other}%
  1522.   \makeactive\<%
  1523.   \def<##1>{$\langle${\it\makeCtrlMspace\makespacespace##1\/}$\rangle$}%
  1524. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1525. %     *****  figures  *****
  1526. \newif\if@@mid  \@@midfalse
  1527. \newif\if@@bot  \@@botfalse
  1528. \def\@caption{}
  1529. \newif\if@fixed \@fixedfalse
  1530.         % items for top and bottom ``banners'' on first page
  1531. \def\resetfirsthead{\global\toplgt=\z@ \gdef\firsthead{}}
  1532. \resetfirsthead
  1533. \newbox\firsth@@d       \newbox\firsth@ad
  1534. \def\resetfirstfoot{\global\botlgt=\z@ \gdef\firstfoot{}}
  1535. \resetfirstfoot
  1536. \newbox\firstf@@t       \newbox\firstf@ot
  1537. \newif\if@allowspanningfigs
  1538. \newcount\@figurepage
  1539. \newcount\@figurescol
  1540. \newcount\@figureecol
  1541. \def\figure{%
  1542.   \begingroup
  1543.   \def\CurrentTag{figure}%
  1544.   \@defaultoptions
  1545.   \@savingargumentfalse
  1546.   \def\top{}%
  1547.   \def\bot{\@@bottrue}%
  1548.   \def\mid{\@@midtrue}%
  1549.   \def\caption##1{\def\@caption{\ulap{\bigskip##1\smallskip}}}%
  1550.   \def\fixed{\@fixedtrue}%
  1551.   \def\scol{\@figurescol}%
  1552.   \def\ecol{\@figureecol}%
  1553.   \@figurepage=\pageno
  1554.   \@figurescol=1
  1555.   \@figureecol=\numcols
  1556.   \def\page{%
  1557.     \@ignoreall{\space}%
  1558.       {\@ignoreone{=}%
  1559.          {\@ignoreall{\space}%
  1560.             {\@checknexttoken{+}{\@ignoreone{+}{\advance\@figurepage by}}%
  1561.                  {\@figurepage=}%
  1562.             }%
  1563.          }%
  1564.       }%
  1565.     }%
  1566.   \@checkoptions}
  1567. \def\@beginfigure{%
  1568.   \if@fixed
  1569.     \global\ThisIsFirstPagetrue
  1570.     \setbox\T@stBox=\vbox\bgroup \hsize\pagewd
  1571.   \else
  1572.     \if@@mid\midinsert\else\if@@bot\botinsert\else\topinsert\fi\fi
  1573.   \fi
  1574. \def\endfigure{%
  1575.   \@caption
  1576.   \if@fixed
  1577.     \egroup
  1578.     \if@allowspanningfigs
  1579.       \ifnum\@figurepage>\pageno
  1580.         \immediate\write\sixt@@n{^^J
  1581.            Setting multiple column figures currently not allowed on pages^^J
  1582.            other than the first of each article.  Check your source file.^^J}%
  1583.       \else
  1584.         \if@@bot
  1585.           \ifdim \botlgt=\z@ \global\botlgt=\ht\T@stBox \resetpagelgt \fi
  1586.           \global\setbox\firstf@ot=\vbox to \botlgt{\box\T@stBox \vfil}%
  1587.           \global\setbox\firstf@@t=\vbox to \botlgt{\vfil}%
  1588.           \gdef\firstfoot{\ifnum \xcol=2 \copy\firstf@ot
  1589.                                   \else \copy\firstf@@t \fi }%
  1590.         \else
  1591.           \ifdim \toplgt=\z@ \global\toplgt=\ht\T@stBox \resetpagelgt \fi
  1592. %                       assume that \firsth@ad ends with glue, hence no \dp
  1593.           \global\setbox\firsth@ad=\vbox to \toplgt{\box\T@stBox \vfil}%
  1594.           \global\setbox\firsth@@d=\vbox to \toplgt{\vfil}%
  1595.           \gdef\firsthead{\ifnum \xcol=2 \box\firsth@ad
  1596.                                   \else \copy\firsth@@d \fi }%
  1597.         \fi
  1598.       \fi
  1599.     \else
  1600.       \immediate\write\sixt@@n{^^J
  1601.          Setting multiple column figures currently not allowed after^^J
  1602.          article has begun.^^J}%
  1603.     \fi
  1604.   \else \endinsert
  1605.   \fi
  1606.   \endgroup
  1607. \def\twocolfigure{%
  1608.   \figure[\fixed]}
  1609. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1610. %     *****  utilities  *****
  1611. \def\linebreak{\unskip\break}           % conflicts with LaTeX definition
  1612. %  Define a structure that will permit a list (using \obeylines)
  1613. %  to be made into 2 columns, split by \vsplit, indented the
  1614. %  normal \parindent
  1615. \def\NormalizeBlockHeight{%
  1616.   \TestCount=1                         % \@ne
  1617.   \TestDimen=\dimen0 \advance\TestDimen by-\topskip
  1618.   \CutOneLine }
  1619. \def\CutOneLine{%
  1620.   \advance\TestCount by 1 \advance\TestDimen by-\baselineskip
  1621.   \ifdim\TestDimen < \baselineskip                        % \@ne
  1622.      \def\result{%
  1623.        \TestDimen=\baselineskip
  1624.        \multiply\TestDimen by \TestCount
  1625.        \advance\TestDimen by \topskip
  1626.        \global\dimen0=\TestDimen }%
  1627.   \else \def\result{\CutOneLine }\fi
  1628.   \result }
  1629. \def\twosplit{%
  1630.   {\topskip=\baselineskip \splittopskip=\topskip
  1631.    \setbox0=\copy\TestBox
  1632.    \dimen0=\ht\TestBox
  1633.    \NormalizeBlockHeight
  1634.    \divide\dimen0 by 2
  1635.    \setbox\LeftHalf=\vsplit\TestBox to \dimen0
  1636.    \ifdim\ht\TestBox > \ht\LeftHalf
  1637.      \advance\dimen0 by \baselineskip
  1638.      \setbox\TestBox=\copy0
  1639.      \setbox\LeftHalf=\vsplit\TestBox to \dimen0
  1640.    \fi
  1641.    \line{\kern\parindent\valign{##\vfil\cr
  1642.          \unvbox\LeftHalf\cr\noalign{\hfil}\unvbox\TestBox\cr}}%
  1643.    }%
  1644.   \global\setbox0=\null}
  1645. \newbox\LeftHalf
  1646. \newdimen\HalfWd
  1647. \HalfWd=\twocolcolwd
  1648. \advance\HalfWd by-\normalparindent
  1649. \divide\HalfWd by 2
  1650. {\obeylines
  1651. \gdef\twouplist #1{%
  1652.   \topskip=\baselineskip \splittopskip=\topskip
  1653.   \begingroup \parindent=\z@ \obeylines
  1654. %                       next line ends with intentional <cr>
  1655.   \def\endtwouplist{
  1656.     \egroup %               % end of \vbox
  1657.     \endgroup %             % end of \obeylines group
  1658.     \twosplit }%
  1659.   \global\setbox\TestBox=\vbox\bgroup\hsize=\HalfWd %
  1660.     \indent\vrule height\topskip width \z@ #1}%
  1661. %  Tags for special formatting of editor's notes  (See also TUGBOAT.COM)
  1662. \def\Editor{\noindent To the Editor:\par}
  1663. \def\EdNote #1{%
  1664.   \if #1[%
  1665.     \ifvmode \smallskip\noindent \else \unskip\hskip1em \fi
  1666.     [\thinspace\xEdNote\ignorespaces
  1667.   \else \ifFirstPar \else \medskip\noindent \fi
  1668.   \xEdNote #1\fi }
  1669. %       Draw a box around a whole page, e.g. announcements page;
  1670. %       format must be \onenarrow or \onemedium, and start on a new page.
  1671. \def\bigbox{\hrule \hbox\bgroup \vrule\kern 1pc
  1672.         \vbox\bgroup \vskip 1pc }
  1673. \def\endbox{\endgraf \vskip 1pc \egroup \kern 1pc\vrule \egroup \hrule }
  1674. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1675. %     *****  initialization  *****
  1676. \def\initializearticle{%
  1677.   \let\thetitle=\relax
  1678.   \authornumber=0
  1679.   \def\@signature{\@defaultsignature}%
  1680.   \def\@authorlist{\@defaultauthorlist}%
  1681.   \@allowspanningfigstrue
  1682. \makeother\@
  1683. %               @ is prohibited in AMS-TeX, but should not be in TUGboat
  1684. \twocol
  1685. \maxcols=2
  1686. \OverlaysinTeXtrue
  1687. \Trimmarksfalse
  1688. \PrelimDrafttrue
  1689. \initializearticle
  1690. \pageno=1001                    % number of title page
  1691. \StretchyTenPointSpacing
  1692. \StretchyNinePointSpacing
  1693. \StretchyEightPointSpacing
  1694. \makevertverbchar
  1695. \endinput
  1696. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1697. %  History of changes
  1698. Version   Date        Changes
  1699. -------   ---------   ---------------------------------------------------
  1700. 1.14      19 Feb 93   installed new TUG address and phone number in header
  1701. 1.13      13 Oct 92   Added \SMC in \ninepoint
  1702. 1.12       4 Jun 92   Added stretchability to \rightskip in ragged title
  1703. 1.11       8 Mar 92   Changed name of tugboat.com to tugboat.cmn to avoid
  1704.                         conflict with special meaning of .com with some
  1705.                         operating systems
  1706.                       Within verbatim, added \smallcode (from tugproc)
  1707.                       Added standard headers, prepared for archive installation
  1708. 1.10      21 Oct 91   Corrected font for \SMC in \tenpoint to \ninerm
  1709.                         (\ninesmc was used, but set to cmcsc10)
  1710.                       Changed \EdNote to detect \ifvmode when tag followed
  1711.                         by [ and to \smallskip and \noindent in that case
  1712.                         rather than performing \hskip1em
  1713. 1.09      11 Mar 91   Made \ an escape character in network addresses.
  1714.                       Added mechanism for saving \long arguments of
  1715.                         TUGboat macros (see uses of \@long).
  1716. 1.08      18 Oct 90   Incorporated redefinition of \sl within \bf
  1717.                       Changed an \input within \verbatim to \fileinput.
  1718.                       Added means of turning off punctuation after subheads.
  1719.                       Removed \nobreak after lists
  1720. 1.07       8 Jun 90   Corrected definition of \newpage
  1721. 1.06      13 May 90   Added \@setupverbwrite to eliminate initial ^^M
  1722.                       as \verbatim writes to a file.
  1723.                       Made strut on first line of footnote slightly taller
  1724.                       so as to separate footnotes.
  1725.                       Reset \@verbinputfile and \@verbinputvar to \relax
  1726.                       to allow nesting
  1727.                       Removed some \global assignments to \@argument and
  1728.                       2 verbatim flags to allow nesting.
  1729. 1.05      23 Apr 90   Added "\setupverbatim" to \@firstverbchar so
  1730.                       that category switches are accomodated properly.
  1731. 1.04       7 Mar 90   Added \colsepwidth to allow for separation between
  1732.                       columns of lists
  1733. 1.03       1 Mar 90   Modified \@dosubhead and \@dosubsubhead to allow
  1734.                       stretchable space afterward
  1735. 1.02      25 Feb 90   Added \resetmaxcols to allow for automatic adjustment
  1736.                       of \maxcols; if overlays are done by the driver,
  1737.                       \maxcols needs to be set to an overall job maximum
  1738.                       at the start of the job.
  1739.                       Added setting of \SecTitletrue to definition
  1740.                       of \sectitle.
  1741.                       Added indicator of style file loaded (\tubstyle).
  1742. 1.01      17 Jan 90   Modified \@executetoend so that \@next would not
  1743.                       be clobbered by \csname @begin\CurrentTag\endcsname;
  1744.                       \@next changed to \@afterbegintag
  1745.                       Added `\the' before \@otherSFD within definition of
  1746.                       \@shortparse
  1747.                       added \@altdisplaystyle to definition of \colsep
  1748.